from pywinauto import Application

from config.settings import APP_CONFIG

# 连接到已运行的程序（确保 Test-System.exe 已启动）
title_name = "条码关联系统 Rev1.1.2"
path = APP_CONFIG["exe_path"]
app = Application(backend="win32").connect(path=path)

# 查找“生产信息设置”窗口
setting_win = app.window(title=title_name)
print("窗口存在:", setting_win.exists(timeout=5))

# 打印所有控件结构
setting_win.print_control_identifiers()